﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YasharEl.Infrastructure.Core.Prototype;
using YasharEl.Infrastructure.Core.ServiceModel.Adapters.Maps;
using YasharEl.Infrastructure.ObjectFactory;
using YasharEl.Infrastructure.ObjectFactory.Adapters;

namespace YasharEl.Infrastructure.Core.ServiceModel.Adapters
{
    public class CoreServiceModelMapRegistrator : RegisterTypesMap
    {
        private readonly IDependencyResolver resolver;

        public CoreServiceModelMapRegistrator(IDependencyResolver resolver)
        {
            Contract.Requires<ArgumentNullException>(resolver != null, "resolver could not be null.");

            this.resolver = resolver;

            SetMaps();
        }

        #region Set Maps

        void SetMaps()
        {
            RegisterMap<IPropertyMapping, PropertyDefinitionDTO>(new PropertyMappingToPropertyDefinitionDTOMap());
            RegisterMap<IPropertyInstance, PropertyAssignmentDTO>(new PropertyInstanceToPropertyAssignmentDTOMap(resolver));
        }

        #endregion
    }
}
